package com.jn.services.imp;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * Created by Zhangkh on 2017/12/26.
 */
@Service
public class TestService {

    protected final static Logger logger = LoggerFactory.getLogger(TestService.class);

    public void run(String name) {
        int i = 0;
        while (i < 100) {
            logger.info(name +"====" + " "+ (i++));
            try {
                Thread.sleep(3 * 1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }

    @Async
    public void test1() {
        logger.info("====test1");
        run("test1");
    }

    @Async
    public void test2() {
        logger.info("====test2");
        run("test2");
    }

    @Async
    public void test3() {
        logger.info("====test3");
        run("test3");
    }

    @Async
    public void test4() {
        logger.info("====test4");
        run("test4");
    }


}
